package com.bwie.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.mapper.EventsMapper;
import com.bwie.pojo.Events;
import com.bwie.service.EventsService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class EventsServiceImpl extends ServiceImpl<EventsMapper, Events> implements EventsService {

    @Autowired
    EventsMapper eventsMapper;

    @Override
    public R list(PageInfoVo pageInfoVo) {
        Page<Events> eventsPage = new Page<>(pageInfoVo.getPageNum(), pageInfoVo.getPageSize());

        Page<Events> selectPage = eventsMapper.selectPage(eventsPage, null);

        log.info("显示抽奖活动数据： {}", selectPage);

        return R.OK(selectPage);
    }
}
